<template>
	<view :class="[BackGround]" :style="[{'font-weight':Style,'font-family':Font,height:100 + '%',minHeight:height + 'px'}]">
		<cu-custom bgColor="bg-gradual-blue" isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">公司公告</view>
		</cu-custom>
		<sear-ch :placeholder="placeholder" @clean="clean" :message="message" @input="input" @remove="remove"></sear-ch>
		<screen-view ref="screen" @formSubmit="formSubmit" :isShow="false" :searchCondition="searchCondition"></screen-view>
		<!-- 下拉刷新组件 -->
		<mix-pulldown-refresh ref="mixPulldownRefresh" :top="CustomBar + 100 " :scrolltopa="scrollTop" @refresh="onPulldownReresh"
		 @setEnableScroll="setEnableScroll"  @scroll='scroll'>
		 <block v-for="(item,index) in deliverplan" :key="index" >
			 <view v-show="item.isShow" class="cu-list menu-avatar comment solids-top" @tap="jump(index)">
			 	<view class="cu-item">
			 		<view class="cu-avatar round">
			 			<image src="/static/images/notificationfill.png" mode="aspectFit"></image>
			 		</view>
			 		<view class="content">
			 			<view class="text-grey">标题</view>
			 			<view class="text-gray text-content text-df">
			 				{{item.ltitle}}
			 			</view>
			 			<view :class="[BackGroundBox,'padding-sm radius margin-top-sm  text-sm'] ">
			 				<view class="flex cu-bar">
			 					<!-- <view></view> -->
			 					<view v-html="item.lpreview" style="height: 100rpx;" class="flex-sub text-cut"></view>
			 				</view>
			 			</view>
			 			<view class="margin-top-sm flex justify-between">
			 				<view class="text-gray text-df">发件人: {{item.lmakeopid}}</view>
			 				<view class="text-gray text-df">{{item.lmakeopdate}}</view>
			 			</view>
			 		</view>
			 	</view>
			 </view>
		 </block>
			
			<mix-load-more :status="2" v-if="!isFlag"></mix-load-more>
		</mix-pulldown-refresh>
		<back-top v-if="isShow" @topClick="topClick">
			<image class="topimg" mode="aspectFit" src="https://www.ahlinghui.com/Uploads/image/20190429/images/BackTop.png"></image>
		</back-top>
		<lime-tips v-if="isFlag" :fixed="true" imgUrl="/static/images/img_noorder@3x.png">咦！暂时没有数据呢……</lime-tips>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	import {
		getselectBulletin
	} from "@/service/selectList"
	import {
		inputSearch,
		scrollrefresh
	} from "@/mixin/mixin.js"
	import SearCh from "@/colorui/components/search.nvue"
	import ScreenView from '@/colorui/components/ScreenView.vue'
	import mixPulldownRefresh from '@/colorui/components/mixpulldownrefresh.vue'
	import mixLoadMore from '@/colorui/components/mixloadmore';
	import BackTop from '@/colorui/components/BackTop.vue'
	export default {
		mixins: [inputSearch, scrollrefresh],
		data() {
			return {
				isShow: false,
				isFlag: false,
				message: '筛选',
				height: this.screenHeight,
				dateleft: global.startbefore,
				dateright: global.dateright,
				placeholder: "标题",
				searchView: 'ltitle',
				searchCondition: [{
					name: '标题',
					code: 'ltitle',
					checked: true
				}, ],
				deliverplan: [],
			}
		},
		components: {
			SearCh,
			ScreenView,
			mixPulldownRefresh,
			mixLoadMore,
			BackTop
		},
		computed: {
			...mapGetters([
				'Style', 'Font', 'BackGround', 'BackGroundBox'
			])
		},
		onLoad() {
			getselectBulletin(this.dateleft,this.dateright,'12').then(res => {
				if(res.code != 0 ) {
					for (let s of res.data) {
						s['isShow'] = true
					}
					this.deliverplan = res.data
				}
			})
		},
		methods: {
			jump(index) {
				uni.navigateTo({
					url: `./Messagedetail?index=${index}&dateleft=${this.dateleft}&dateright=${this.dateright}`
				})
			},
			formSubmit(e) {
				this.dateleft = e.picker1
				this.dateright = e.picker2
				getselectBulletin(this.dateleft,this.dateright,'12').then(res => {
					if(res.code != 0 ) {
						for (let s of res.data) {
							s['isShow'] = true
						}
						this.deliverplan = res.data
					}
				})
			}
		},
		watch: {
			deliverplan() {
				this.deliverplan.length ? this.isFlag = false : this.isFlag = true
			}
		},
	}
</script>

<style>
	.topimg {
		width: 100rpx;
		height: 100rpx;
	}

	.cu-avatar {
		background-color: whitesmoke !important;
	}
</style>
